import {systemStoreHook} from "@/stores/modules";
import { commonState } from '@/common/index.js'

const systemStore = systemStoreHook();
export const pageSearch = reactive({
    pageNumber: commonState.pageNumber,
    pageSize: commonState.pageSize,
    parentId: 0
});


export const tableState = reactive({
    totalCount: 0,
    records: []
});
export const state = reactive({
    selectedRowKeys: [],
    loading: false,
    subLoading: false
});
export const setLoading = (loading) => {
    state.loading = loading;
}

export const setSubLoading = (loading) => {
    state.subLoading = loading;
}
//表单列表
export const columns = [
    {
        title: '部门名称',
        dataIndex: 'name',
        key: 'name',
        align: 'left',
        ellipsis: true
    },
    {
        title: '创建时间',
        dataIndex: 'createDate',
        key: 'createDate',
        align: 'center',
    },
    {
        title: '操作',
        key: 'operation',
        fixed: 'right',
        align: 'center',
        width: 160,
    }
]

export const rules = reactive({
    name: [{required: true, message: '请输入部门名称', trigger: 'blur'}],
});

//查询
export const searchState = reactive ({
})

//明细
export const detailState = reactive ({
})

//设置查询参数
export function setSearchParam() {
    Object.assign(pageSearch, systemStore.getDeptSearch);
    return pageSearch;
}

